#include <iostream>
#include <algorithm>

using namespace std;

const int N = 3e4 + 10;

int w, n;
int a[N];

int main()
{
	cin >> w >> n;
	for (int i = 1; i <= n; i++)	cin >> a[i];

	sort(a + 1, a + 1 + n);

	int left = 1, right = n, cnt = 0;
	while (left <= right)
	{
		// 最大的的匹配最小的, 如果不能则最大的单独一组
		if (a[left] + a[right] <= w)
		{
			left++;
			right--;
		}
		else
			right--;

		cnt++;
	}
	cout << cnt << endl;

	return 0;
}